define([

], function () {

    var Model = Backbone.Model.extend({
        uploadKML: function (kml, callbackOk) {
            var url = __geoConvertBaseUrl + "uploader.aspx";

            var options = {
                dataType: 'text',
                success: function (data, textStatus, jqXHR) {
                    callbackOk(data);
                },
                type: 'POST',
                data: {
                    data: encodeURIComponent(kml)
                }
            };

            $.ajax(url, options);
        },
        listLayerLibrary: function (callbackOk) {
            send("FPLayerLibrary/List", null, null, callbackOk);
        },
        createLayerLibrary: function (name, data) {
            var obj = {
                name: name,
                content: encodeURIComponent(data)
            }
            send("FPLayerLibrary/Create", obj, { type: "POST" });
        },
        getLayerLibrary: function (id, callbackOk) {
            send("FPLayerLibrary/Get/" + id, null, null, callbackOk);
        },
    });
    return Model;
});